var userAdd = function () {

    var addinfo = function () {
        layui.use(['form', 'layer'], function () {
            var form = layui.form,
                layer = layui.layer;

            //监听提交
            form.on('submit(add)', function (data) {
                // 获得frame索引
                var data = {
                    name: $("#strName").val(),
                    //sex: $('#strSex input[name="strSex"]:checked').val(),
                    number: $("#strNumber").val(),
                    age: $("#strAge").val(),
                }
                $.ajax({
                    url: "/user/save",
                    type: "post",
                    data: JSON.stringify(data)
                    , datatype: "json"
                    , contentType: 'application/json'
                    , success: function (result) {
                        //var obj = JSON.parse(result);
                        if (result.code == 200) {

                            // 获得frame索引
                            var index = parent.layer.getFrameIndex(window.name);
                            //关闭当前frame
                            parent.layer.close(index);
                            // 可以对父窗口进行刷新
                            x_admin_father_reload();
                        } else {
                            layer.msg(result.msg)
                        }
                    }
                });
                return false;
            });
        })
    };

    return {
        init: function () {
            addinfo();
        }
    };
}();